package com.orchard.xpz.controller.sysUser;

import com.orchard.xpz.entity.GardenPlot.GardenPlot;
import com.orchard.xpz.entity.sysUser.SysUser;
import com.orchard.xpz.service.sysUser.SysUserService;
import com.orchard.xpz.utils.PageResultData;
import com.orchard.xpz.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @TaskCode:
 * @description: 用户管理界面
 * @author: minshuai.chen
 * @create: 2022/4/13 14:10
 **/
@RequestMapping("/user")
@RestController
public class SysController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/getPageList")
    public R<PageResultData<SysUser>> getPageList(@RequestBody SysUser sysUser){
        PageResultData<SysUser> listUser = sysUserService.getPageList(sysUser);
        return R.success(listUser,"测试成功");
    }

    @RequestMapping("/saveOrUpdate")
    public R<String> saveOrUpdate(@RequestBody SysUser sysUser){
        if (sysUserService.saveOrUpdate(sysUser)){
            return R.success("success");
        }else{
            return R.fail("error");
        }
    }

}
